<?php

namespace app\store\controller\user;

use app\store\model\UserAuth as UserAuthModel;
use app\store\controller\Controller;

/**
 * 用户管理
 * Class UserAuth
 * @package app\store\controller
 */
class UserAuth extends Controller
{
    public function all()
    {
        return $this->getList('all');
    }
    public function authend()
    {
        return $this->getList('authend');
    }
    public function unauth()
    {
        return $this->getList('unauth');
    }

    private function getList($type)
    {
        $filter = [];
        switch($type){
            case 'all':
                break;
            case 'authend':
                $filter['auth_status'] = 20;
            break;
            case 'unauth':
                $filter['auth_status'] = 10;
            break;
        }
        $list = UserAuthModel::where($filter)->paginate(15, false, [
            'query' => $this->request->request()
        ]);
        return view('index', compact('list'));
    }
}